// 导入路由包
import { createRouter, createWebHashHistory } from 'vue-router'
// 导入要使用的组件
import Home from './MyHome.vue'
import Movie from './MyMovie.vue'
import About from './MyAbout.vue'
import Tab1 from './Tab1.vue'
import Tab2 from './Tab2.vue'
// 创建实例对象
const router = createRouter({
        //指定history路由的工作模式
        history: createWebHashHistory(),
        linkActiveClass: 'router-active',
        routes: [
            { path: '/', redirect: '/home' },
            { path: '/home', component: Home },
            { path: '/movie/:id', component: Movie, props: true },
            {
                path: '/about',
                component: About,
                redirect: '/about/tab1',
                children: [
                    { path: 'tab1', component: Tab1 },
                    { path: 'tab2', component: Tab2 }
                ]
            }
        ]
    })
    // 向外导出模块
export default router